extends layout

block content
  h1= 图片共享
  .row
    .col-12.col-md-8.mt-2
      .card#mainimage(data-id=image._id)
        .card-header.bg-primary.text-white= image.title
        .card-body
          img.card-img-top(src='/' + image.imagepath, alt=image.title)
          .mt-2
            .btn.bg-success.text-white#praise-btn
              .fa.fa-heart
              span.ml-2 赞
            span.ml-2#spanlikes= image.likes
            | &nbsp;-&nbsp;
            i.fa.fa-eye
            span.ml-2= image.views
            | &nbsp;-&nbsp;
            span.ml-2
              | 上传时间：
              span= createdAt
            .btn.btn-danger.float-right#delete-btn
              .fa.fa-times
      .card.mt-2
        .card-header 评论
        .card-body
          form(action="/addComment", method="post")
            .form-group.row
              label.col-12.col-md-3.col-form-label 用户名
              .col-12.col-md-9
                input.form-control(type="text", name="name")
                input(type="hidden",name="imageid",value=image._id)
            .form-group.row
              label.col-12.col-md-3.col-form-label 邮箱
              .col-12.col-md-9
                input.form-control(type="email", name="email")
            .form-group.row
              label.col-12.col-md-3.col-form-label 评论
              .col-12.col-md-9
                textarea.form-control(rows="3", name="comment")
            .row
              .offset-8.col-4       
                button.form-control.btn.btn-success(type="submit")
                  i.fa.fa-comment.mr-2
                  | 提交评论
      .card.mt-2
        .card-header 最新评论
        .card-body 
          .row
            each comment in comments
              .col-12.mt-3               
                  h5 #{comment.comment}
                  h7  #{comment.name} &nbsp&nbsp&nbsp  #{comment.email}
                  .card-text  #{comment.time}
    .col-12.col-md-4.mt-2
      include sider.pug
  script(src="../javascripts/actions.js")